/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作
const install = (Vue, vm) => {
	
	// 参数配置对象
	const config = vm.vuex_config;
	
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		
		// 基础服务：登录登出、身份信息、菜单授权、切换系统、字典数据等
		lang: (params = {}) => vm.$u.get('/lang/'+params.lang),
		index: (params = {}) => vm.$u.get(config.adminPath+'/index', params),
		login: (params = {}) => vm.$u.post(config.adminPath+'/login', params),
		logout: (params = {}) => vm.$u.get(config.adminPath+'/logout', params),
		authInfo: (params = {}) => vm.$u.get(config.adminPath+'/authInfo', params),
		menuTree: (params = {}) => vm.$u.get(config.adminPath+'/menuTree', params),
		switchSys: (params = {}) => vm.$u.get(config.adminPath+'/switch/'+params.sysCode),
		dictData: (params = {}) => vm.$u.get(config.adminPath+'/sys/dictData/treeData', params),
		
		// 账号服务：验证码接口、忘记密码接口、注册账号接口等
		validCode: (params = {}) => vm.$u.getText('/validCode', params),
		getFpValidCode: (params = {}) => vm.$u.post('/account/getFpValidCode', params),
		savePwdByValidCode: (params = {}) => vm.$u.post('/account/savePwdByValidCode', params),
		getRegValidCode: (params = {}) => vm.$u.post('/account/getRegValidCode', params),
		saveRegByValidCode: (params = {}) => vm.$u.post('/account/saveRegByValidCode', params),
		
		// APP公共服务
		upgradeCheck: () => vm.$u.post('/app/upgrade/check', {appCode: config.appCode, appVersion: config.appVersion}),
		commentSave: (params = {}) => vm.$u.post('/app/comment/save', params),
		
		// 个人信息修改
		user: {
			infoSaveBase: (params = {}) => vm.$u.post(config.adminPath+'/sys/user/infoSaveBase', params),
			infoSavePwd: (params = {}) => vm.$u.post(config.adminPath+'/sys/user/infoSavePwd', params),
			infoSavePqa: (params = {}) => vm.$u.post(config.adminPath+'/sys/user/infoSavePqa', params),
		},
		
		// 员工用户查询
		empUser: {
			listData: (params = {}) => vm.$u.get(config.adminPath+'/sys/empUser/listData', params),
		},
		
		// 组织机构查询
		office: {
			treeData: (params = {}) => vm.$u.get(config.adminPath+'/sys/office/treeData', params),
		},
		
		// 增删改查例子
		testData: {
			form: (params = {}) => vm.$u.post(config.adminPath+'/test/testData/form', params),
			list: (params = {}) => vm.$u.post(config.adminPath+'/test/testData/listData', params),
			save: (params = {}) => vm.$u.postJson(config.adminPath+'/test/testData/save', params),
			disable: (params = {}) => vm.$u.post(config.adminPath+'/test/testData/disable', params),
			enable: (params = {}) => vm.$u.post(config.adminPath+'/test/testData/enable', params),
			delete: (params = {}) => vm.$u.post(config.adminPath+'/test/testData/delete', params),
		},
		
		shop: {
			// 登录配置
			form: (params = {}) => vm.$u.get('/f/shop/shopAppsetLogin/loginForm', params),
			// 获取主页配置
			// homeForm: (params = {}) => vm.$u.get(config.adminPath+'/shop/sethome/shopAppsetHome/fbData', params),
			homeForm: (params = {}) => vm.$u.get(config.adminPath+'/shop/api/homeSetData', params),
			// 获取存货明细配置
			// shopInvForm: (params = {}) => vm.$u.get(config.adminPath+'/shop/shopInv/form', params),
			shopInvForm: (params = {}) => vm.$u.get(config.adminPath+'/shop/api/invSetData', params),
			
			
			//  获取产品系列列表
			proClsListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/proClsListData', params),
			
			//  获取公告详情
			noticeListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/noticeListData', params),
			noticeSetData: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/noticeSetData', params),
			
			//  获取促销详情
			sellSetData: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/sellSetData', params),
			// 获取套餐包详情 salesData
			salesData: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/salesData', params),
			
			// 分类
			invClsListData: (params = {}) => vm.$u.get(config.adminPath+'/shop/api/invClsListData', params),
			invListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/invListData', params),
			
			invExtClsListData: (params = {}) => vm.$u.get(config.adminPath+'/shop/api/invExtClsListData', params),
			invExtListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/invExtListData', params),
			
			
			
			// 获取用户关联客户对照
			findUserCusList: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/findUserCusList', params),
			
			// 切换门店 
			switchCus: (params = {}) => vm.$u.get(config.adminPath+'/switchCus/'+params.cusCode),
			
			// 授权绑定
			// bindWxOpenid: (params = {}) => vm.$u.post(config.adminPath+'/bindWxOpenid', params),
			bindWxOpenid: (params = {}) => vm.$u.post('/weixinMa/bindWxOpenid', params),
			// 解绑
			cleanWxOpenid: (params = {}) => vm.$u.post('/weixinMa/cleanWxOpenid', params),
			
			// 获取openId
			getOpenId: (params = {}) => vm.$u.post('/weixinMa/getOpenId', params),
			
			
			// 新增购物车
			addToCart: (params = {}) => vm.$u.postJson(config.adminPath+'/shop/car/shopCar/addToCart', params),
			// 购物车列表
			// cartListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/car/shopCar/listData', params),
			cartListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/car/shopCar/cartListData', params),
			
			// 删除购物车
			cleanAllCart: (params = {}) => vm.$u.post(config.adminPath+'/shop/car/shopCar/cleanAllCart', params),
			// 修改数量购物车
			updateCount: (params = {}) => vm.$u.post(config.adminPath+'/shop/car/shopCar/updateCount', params),

			// /shop/car/shopCar/shopSalesData
			shopSalesData: (params = {}) => vm.$u.post(config.adminPath+'/shop/car/shopCar/shopSalesData', params),
			
			
			// 其它图片地址
			setListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/other/set/listData', params),
			
			// 我的账户
			wecharCusMoney: (params = {}) => vm.$u.post(config.adminPath+'/setting/price/wecharCusMoney/listData', params),
			getCusMoney: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/getCusMoney', params),
			
			// 地址
			cusAddress: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/cusAddress', params),
			
			// 物流
			orderInfo: (params = {}) => vm.$u.post(config.adminPath+'/kdn/api/orderInfo', params),
			
			wlInfo: (params = {}) => vm.$u.post(config.adminPath+'/kdn/api/wlInfo', params),
			
			wlTest: (params = {}) => vm.$u.post(config.adminPath+'/kdn/api/wlTest', params),
			
			
			
			
			// 获取门店信息
			getCurCus: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/getCurCus', params),
			
			// 获取当前运营中心OR运管中心对应的门店列表
			findMnCusListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/findMnCusListData', params),
			
			// 获取结算信息
			shopCarBalanceForm: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/shopCarBalanceForm', params),

			// 获取赠品列表
			giftListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/giftListData', params),

			// 优先级存货
			findInvExcData: (params = {}) => vm.$u.post(config.adminPath+'/shop/api/findInvExcData', params),
			
			
			// 提交订单 生成销售订单
			saveOrderFromShopCar: (params = {}) => vm.$u.postJson(config.adminPath+'/shop/order/soMain/saveOrderFromShopCar', params),
			
			// 订单列表
			orderListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/order/soMain/orderListData', params),
			
			// 订单状态数量
			orderStatusCount: (params = {}) => vm.$u.post(config.adminPath+'/shop/order/soMain/orderStatusCount', params),
			
			// 确定收货
			confirm: (params = {}) => vm.$u.post(config.adminPath+'/shop/order/soMain/confirm', params),
			
			// 删除
			delete: (params = {}) => vm.$u.post(config.adminPath+'/shop/order/soMain/delete', params),
			
			// 延长
			delay: (params = {}) => vm.$u.post(config.adminPath+'/shop/order/soMain/delay', params),
			
			
			// 获取消息订阅模板
			
			getTempleteIda: (params = {}) => vm.$u.post('/weixinMa/getTempleteId', params),
			
			// 可开票订单列表
			kpListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/order/soMain/kpListData', params),
			
			// 抬头列表
			ttlistData: (params = {}) => vm.$u.post(config.adminPath+'/bas/cus/basCusKpinfo/listData', params),
			// 抬头删除
			ttdelete: (params = {}) => vm.$u.post(config.adminPath+'/bas/cus/basCusKpinfo/delete', params),
			// 抬头保存
			ttsave: (params = {}) => vm.$u.post(config.adminPath+'/bas/cus/basCusKpinfo/save', params),
			
			// 默认开票信息
			defCusInfo: (params = {}) => vm.$u.post(config.adminPath+'/bas/cus/basCusKpinfo/defCusInfo', params),
			
			// 确定开票申请
			saveBySel: (params = {}) => vm.$u.postJson(config.adminPath+'/shop/order/cusFpApply/saveBySel', params),
			
			// 历史
			fpApplylistData: (params = {}) => vm.$u.post(config.adminPath+'/shop/order/cusFpApply/listData', params),
			
			// 历史详情
			fpApplyForm: (params = {}) => vm.$u.get(config.adminPath+'/shop/order/cusFpApply/form', params),
			
			// 文件
			fileList: (params = {}) => vm.$u.post(config.adminPath+'/file/fileList', params),
			
			addressListData: (params = {}) => vm.$u.post(config.adminPath+'/bas/cus/address/listData', params),

			// 赠品相关接口
			shopGiftData: (params = {}) => vm.$u.post(config.adminPath+'/shop/gift/shopGiftData/listData', params),
			giftDetail: (params = {}) => vm.$u.get(config.adminPath+'/shop/api/giftDetail', params),
			// 
			shopGiftListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/gift/shopGiftData/shopListData', params),
			viewListData: (params = {}) => vm.$u.post(config.adminPath+'/shop/gift/shopGiftData/viewListData', params),
			// 验证套餐包勾选规则 
			selPackage: (params = {}) => vm.$u.postJson(config.adminPath+'/shop/sales/shopSalesPackage/selPackage', params),
			
		},
		
	};
	
}

export default {
	install
}